package com.car.loan.project.xr.util.vo;

import com.car.loan.project.xr.util.enums.BusinessApostilleStatus;
import com.car.loan.project.xr.util.enums.LoanBusinessAuditStatus;
import com.car.loan.project.xr.util.enums.LoanBusinessStatus;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * @author huangding
 * @date 2020/2/21 19:49
 */
@Data
public class SearchDeleteVo {

    @ApiModelProperty("业务id")
    private String id;

    @ApiModelProperty("业务编号")
    private String businessNo;

    @ApiModelProperty("客户名称")
    private String customerName;

    @ApiModelProperty("车辆类型")
    private String carType;

    @ApiModelProperty("车辆性质")
    private String carNature;

    @ApiModelProperty("分期金额")
    private Double installmentAmount;

    @ApiModelProperty("合同车价")
    private Double sellAmount;

    @ApiModelProperty("期数")
    private Integer term;

    @ApiModelProperty("银行名称")
    private String bankName;

    @ApiModelProperty("部门名称")
    private String deptName;

    @ApiModelProperty("业务员")
    private String adminName;

    @ApiModelProperty("合作商户")
    private String dealerName;

    @ApiModelProperty("删除时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deletedTime;

    @ApiModelProperty("业务状态 0=未提交 1=已提交")
    @JsonIgnore
    private Long businessStatus;

    @ApiModelProperty("业务审核状态0=未审核1=通过2=拒绝3=退回4=加签")
    @JsonIgnore
    private Long businessAuditStatus;

    @ApiModelProperty("加签审核状态0=未审核1=通过2=拒绝3=退回")
    @JsonIgnore
    private Long businessApostilleStatus;

    @ApiModelProperty("状态")
    private String status;

    public String getStatus() {
        if (BusinessApostilleStatus.REJECT.status == businessApostilleStatus) {
            return "加签拒绝";
        }

        if (BusinessApostilleStatus.GO_BACK.status == businessApostilleStatus) {
            return "加签退回";
        }

        if (LoanBusinessAuditStatus.REJECT.status == businessAuditStatus) {
            return "审批拒绝";
        }
        if (LoanBusinessAuditStatus.GO_BACK.status == businessAuditStatus) {
            return "审批退回";
        }
        if (LoanBusinessStatus.INIT.status == businessStatus) {
            return "未提交";
        }
        return status;
    }
}
